<template>
   <div>
         <van-nav-bar
            title="充值记录"
            left-text="返回"
            left-arrow
            @click-left="exit"
            />
            <van-row class="list" v-show="empty">
               <van-col span="24" >
                  <van-empty description="充值记录为空" />
               </van-col>
            </van-row>

            <van-row class="list">
               <van-col span="24" >
                  <van-cell 
                  v-for="(item,index) in changelist" :key="index"
                  :title="item.username" :value="item.addmoney+'元'" size="large" :label="item.createdate" >

               </van-cell>
               </van-col>
            </van-row>

   </div> 
</template>


   
<script>
    import { Toast } from 'vant';
    import {getChangeMoney} from '@/api/index'
    import { Empty } from 'vant';
import { onMounted } from 'vue';
    export default {
        data() {
            return {
               changelist:{},
               empty:false
            };
        },
        methods:{
            exit(){
                this.$router.go(-1)
            },
            getRecordList(){
               getChangeMoney(localStorage.getItem("username")).then(res=>{
                  // console.log(res.data);
                  this.changelist=res.data.data
                  if(this.changelist==null)
                     this.empty=true
               })
            }
        },
        mounted(){
         this.getRecordList()
        }
    
    }
</script>
<style>
   .list{
      margin-top: 4rem;
   }
</style>